namespace SmartSoft.ReportForms
{
    using SmartSoft;
    using SmartSoft.Controls;
    using SmartSoft.ADP;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormBCTDSCViewer : FormReportViewer
    {
        private IContainer components;
        private LabelControl lblMa_Nh_Ts;
        private LabelControl lblMa_Ts;
        private LabelControl lblNgay_Ct1;
        private TextSearch txtMa_Nh_Ts;
        private TextSearch txtMa_Ts;
        private TextDate txtNgay_Ct2;
        private TextControl txtTen_Nh_Ts;
        private TextDate txtNgay_Ct1;
        private LabelControl lblTu_Ngay;
        private TextControl txtTen_Bp;
        private TextSearch txtMa_Bp;
        private LabelControl lblMa_Bp;
        private TextControl txtTen_Ts;

        public FormBCTDSCViewer()
        {
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = AppInstance.StartWorkingDate;
            this.txtNgay_Ct2.Value = AppInstance.EndWorkingDate;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.txtTen_Ts = new SmartSoft.Controls.TextControl();
            this.txtMa_Ts = new SmartSoft.Controls.TextSearch();
            this.lblMa_Ts = new SmartSoft.Controls.LabelControl();
            this.txtNgay_Ct2 = new SmartSoft.Controls.TextDate();
            this.lblNgay_Ct1 = new SmartSoft.Controls.LabelControl();
            this.txtTen_Nh_Ts = new SmartSoft.Controls.TextControl();
            this.txtMa_Nh_Ts = new SmartSoft.Controls.TextSearch();
            this.lblMa_Nh_Ts = new SmartSoft.Controls.LabelControl();
            this.txtNgay_Ct1 = new SmartSoft.Controls.TextDate();
            this.lblTu_Ngay = new SmartSoft.Controls.LabelControl();
            this.txtTen_Bp = new SmartSoft.Controls.TextControl();
            this.txtMa_Bp = new SmartSoft.Controls.TextSearch();
            this.lblMa_Bp = new SmartSoft.Controls.LabelControl();
            this.rptContainer.Panel1.SuspendLayout();
            this.rptContainer.SuspendLayout();
            this.SuspendLayout();
            // 
            // rptContainer
            // 
            // 
            // rptContainer.Panel1
            // 
            this.rptContainer.Panel1.Controls.Add(this.txtTen_Bp);
            this.rptContainer.Panel1.Controls.Add(this.txtMa_Bp);
            this.rptContainer.Panel1.Controls.Add(this.lblMa_Bp);
            this.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.lblTu_Ngay);
            this.rptContainer.Panel1.Controls.Add(this.txtTen_Nh_Ts);
            this.rptContainer.Panel1.Controls.Add(this.txtMa_Nh_Ts);
            this.rptContainer.Panel1.Controls.Add(this.lblMa_Nh_Ts);
            this.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct2);
            this.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.txtTen_Ts);
            this.rptContainer.Panel1.Controls.Add(this.txtMa_Ts);
            this.rptContainer.Panel1.Controls.Add(this.lblMa_Ts);
            this.rptContainer.Size = new System.Drawing.Size(794, 496);
            this.rptContainer.SplitterDistance = 88;
            // 
            // txtTen_Ts
            // 
            this.txtTen_Ts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Ts.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Ts.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Ts.CheckTextSearched = false;
            this.txtTen_Ts.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Ts.Enabled = false;
            this.txtTen_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Ts.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Ts.Location = new System.Drawing.Point(214, 47);
            this.txtTen_Ts.Name = "txtTen_Ts";
            this.txtTen_Ts.OldValue = null;
            this.txtTen_Ts.Size = new System.Drawing.Size(458, 13);
            this.txtTen_Ts.TabIndex = 5;
            this.txtTen_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            // 
            // txtMa_Ts
            // 
            this.txtMa_Ts.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Ts.CheckTextSearched = false;
            this.txtMa_Ts.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Ts.EmptyIsValid = true;
            this.txtMa_Ts.FieldDisplay = "Ten_Ts";
            this.txtMa_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Ts.FoundIsValid = true;
            this.txtMa_Ts.Location = new System.Drawing.Point(108, 44);
            this.txtMa_Ts.MaxLength = 32;
            this.txtMa_Ts.Name = "txtMa_Ts";
            this.txtMa_Ts.OldValue = null;
            this.txtMa_Ts.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Ts.TabIndex = 4;
            this.txtMa_Ts.TableName = "DMTS";
            this.txtMa_Ts.TextDisplay = this.txtTen_Ts;
            this.txtMa_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            // 
            // lblMa_Ts
            // 
            this.lblMa_Ts.AutoSize = true;
            this.lblMa_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Ts.Location = new System.Drawing.Point(12, 47);
            this.lblMa_Ts.Name = "lblMa_Ts";
            this.lblMa_Ts.Size = new System.Drawing.Size(55, 14);
            this.lblMa_Ts.TabIndex = 87;
            this.lblMa_Ts.Text = "Mã thiết bị";
            // 
            // txtNgay_Ct2
            // 
            this.txtNgay_Ct2.DateTimeFormat = SmartSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct2.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct2.Location = new System.Drawing.Point(307, 65);
            this.txtNgay_Ct2.Mask = "00/00/0000";
            this.txtNgay_Ct2.Name = "txtNgay_Ct2";
            this.txtNgay_Ct2.OldValue = null;
            this.txtNgay_Ct2.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct2.TabIndex = 7;
            // 
            // lblNgay_Ct1
            // 
            this.lblNgay_Ct1.AutoSize = true;
            this.lblNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct1.Location = new System.Drawing.Point(211, 68);
            this.lblNgay_Ct1.Name = "lblNgay_Ct1";
            this.lblNgay_Ct1.Size = new System.Drawing.Size(54, 14);
            this.lblNgay_Ct1.TabIndex = 98;
            this.lblNgay_Ct1.Text = "Đến ngày";
            // 
            // txtTen_Nh_Ts
            // 
            this.txtTen_Nh_Ts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Nh_Ts.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Nh_Ts.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Nh_Ts.CheckTextSearched = false;
            this.txtTen_Nh_Ts.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nh_Ts.Enabled = false;
            this.txtTen_Nh_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Nh_Ts.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nh_Ts.Location = new System.Drawing.Point(214, 26);
            this.txtTen_Nh_Ts.Name = "txtTen_Nh_Ts";
            this.txtTen_Nh_Ts.OldValue = null;
            this.txtTen_Nh_Ts.Size = new System.Drawing.Size(458, 13);
            this.txtTen_Nh_Ts.TabIndex = 3;
            this.txtTen_Nh_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Nh_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            // 
            // txtMa_Nh_Ts
            // 
            this.txtMa_Nh_Ts.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Nh_Ts.CheckTextSearched = false;
            this.txtMa_Nh_Ts.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Nh_Ts.EmptyIsValid = true;
            this.txtMa_Nh_Ts.FieldDisplay = "Ten_Nh_Ts";
            this.txtMa_Nh_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Nh_Ts.FoundIsValid = true;
            this.txtMa_Nh_Ts.Location = new System.Drawing.Point(108, 23);
            this.txtMa_Nh_Ts.MaxLength = 32;
            this.txtMa_Nh_Ts.Name = "txtMa_Nh_Ts";
            this.txtMa_Nh_Ts.OldValue = null;
            this.txtMa_Nh_Ts.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Nh_Ts.TabIndex = 2;
            this.txtMa_Nh_Ts.TableName = "DMNHTS";
            this.txtMa_Nh_Ts.TextDisplay = this.txtTen_Nh_Ts;
            this.txtMa_Nh_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Nh_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            // 
            // lblMa_Nh_Ts
            // 
            this.lblMa_Nh_Ts.AutoSize = true;
            this.lblMa_Nh_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Nh_Ts.Location = new System.Drawing.Point(12, 26);
            this.lblMa_Nh_Ts.Name = "lblMa_Nh_Ts";
            this.lblMa_Nh_Ts.Size = new System.Drawing.Size(68, 14);
            this.lblMa_Nh_Ts.TabIndex = 105;
            this.lblMa_Nh_Ts.Text = "Nhóm thiết bị";
            // 
            // txtNgay_Ct1
            // 
            this.txtNgay_Ct1.DateTimeFormat = SmartSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct1.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct1.Location = new System.Drawing.Point(108, 65);
            this.txtNgay_Ct1.Mask = "00/00/0000";
            this.txtNgay_Ct1.Name = "txtNgay_Ct1";
            this.txtNgay_Ct1.OldValue = null;
            this.txtNgay_Ct1.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct1.TabIndex = 6;
            // 
            // lblTu_Ngay
            // 
            this.lblTu_Ngay.AutoSize = true;
            this.lblTu_Ngay.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTu_Ngay.Location = new System.Drawing.Point(12, 68);
            this.lblTu_Ngay.Name = "lblTu_Ngay";
            this.lblTu_Ngay.Size = new System.Drawing.Size(47, 14);
            this.lblTu_Ngay.TabIndex = 107;
            this.lblTu_Ngay.Text = "Từ ngày";
            // 
            // txtTen_Bp
            // 
            this.txtTen_Bp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Bp.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Bp.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Bp.CheckTextSearched = false;
            this.txtTen_Bp.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Bp.Enabled = false;
            this.txtTen_Bp.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Bp.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Bp.Location = new System.Drawing.Point(214, 5);
            this.txtTen_Bp.Name = "txtTen_Bp";
            this.txtTen_Bp.OldValue = null;
            this.txtTen_Bp.Size = new System.Drawing.Size(458, 13);
            this.txtTen_Bp.TabIndex = 1;
            this.txtTen_Bp.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Bp.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            // 
            // txtMa_Bp
            // 
            this.txtMa_Bp.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Bp.CheckTextSearched = false;
            this.txtMa_Bp.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Bp.EmptyIsValid = true;
            this.txtMa_Bp.FieldDisplay = "Ten_Bp";
            this.txtMa_Bp.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Bp.FoundIsValid = true;
            this.txtMa_Bp.Location = new System.Drawing.Point(108, 2);
            this.txtMa_Bp.MaxLength = 32;
            this.txtMa_Bp.Name = "txtMa_Bp";
            this.txtMa_Bp.OldValue = null;
            this.txtMa_Bp.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Bp.TabIndex = 0;
            this.txtMa_Bp.TableName = "DMBP";
            this.txtMa_Bp.TextDisplay = this.txtTen_Bp;
            this.txtMa_Bp.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Bp.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            // 
            // lblMa_Bp
            // 
            this.lblMa_Bp.AutoSize = true;
            this.lblMa_Bp.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Bp.Location = new System.Drawing.Point(12, 5);
            this.lblMa_Bp.Name = "lblMa_Bp";
            this.lblMa_Bp.Size = new System.Drawing.Size(47, 14);
            this.lblMa_Bp.TabIndex = 110;
            this.lblMa_Bp.Text = "Bộ phận";
            // 
            // FormBCTDTSViewer
            // 
            this.CheckDetailMost = true;
            this.ClientSize = new System.Drawing.Size(794, 528);
            this.Name = "FormBCTDSCViewer";
            this.rptContainer.Panel1.ResumeLayout(false);
            this.rptContainer.Panel1.PerformLayout();
            this.rptContainer.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        protected override void OnGenerateColumns()
        {
            object[][] objArray = new object[10][];
            object[] objArray2 = new object[4];
            objArray2[0] = "So_Ct";
            objArray2[1] = "Số Ct";
            objArray2[2] = "C";
            objArray[0] = objArray2;
            object[] objArray3 = new object[4];
            objArray3[0] = "Ngay_Ts";
            objArray3[1] = "Ngày";
            objArray3[2] = "D";
            objArray[1] = objArray3;
            object[] objArray4 = new object[4];
            objArray4[0] = "Ma_Ts";
            objArray4[1] = "Mã tài sản";
            objArray4[2] = "C";
            objArray[2] = objArray4;
            object[] objArray5 = new object[4];
            objArray5[0] = "Ten_Ts";
            objArray5[1] = "Tên tài sản";
            objArray5[2] = "C";
            objArray[3] = objArray5;
            object[] objArray6 = new object[4];
            objArray6[0] = "Dvt";
            objArray6[1] = "Đơn vị tính";
            objArray6[2] = "C";
            objArray[4] = objArray6;
            object[] objArray7 = new object[4];
            objArray7[0] = "So_Hieu";
            objArray7[1] = "Số hiệu";
            objArray7[2] = "C";
            objArray[5] = objArray7;
            object[] objArray8 = new object[4];
            objArray8[0] = "Ngay_Giam";
            objArray8[1] = "Ngày giảm";
            objArray8[2] = "C";
            objArray[6] = objArray8;
            object[] objArray9 = new object[4];
            objArray9[0] = "Loai";
            objArray9[1] = "Tình trạng";
            objArray9[2] = "C";
            objArray[7] = objArray9;
            object[] objArray10 = new object[4];
            objArray10[0] = "Ten_Dt";
            objArray10[1] = "Người nhận";
            objArray10[2] = "C";
            objArray[8] = objArray10;
            object[] objArray11 = new object[4];
            objArray11[0] = "Ten_Bp";
            objArray11[1] = "Bộ phận nhận";
            objArray11[2] = "C";
            objArray[9] = objArray11;
            base.LocalColNames = objArray;
            base.OnGenerateColumns();
        }

        protected override void OnMakeReport()
        {
            AppInstance.StartWorkingDate = (DateTime)this.txtNgay_Ct1.Value;
            AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct2.Value;
            base.LocalTable = new ReportDataAccess().BCTDSC_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtMa_Bp.Value, this.txtMa_Nh_Ts.Value, this.txtMa_Ts.Value, AppInstance.DefLanguage);
            base.OnMakeReport();
        }

        protected override void OnSendParameters()
        {
            base.StimulReport["Ngay"] = "Từ ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct1.Value) + " đến ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct2.Value);
            base.StimulReport["Kho"] = "";
            if (string.IsNullOrEmpty(this.txtMa_Nh_Ts.Value.ToString()))
            {
                base.StimulReport["NhomVatTu"] = "";
            }
            else
            {
                base.StimulReport["NhomVatTu"] = string.Concat(new object[] { "Nhóm tài sản: ", this.txtTen_Nh_Ts.Value, " (", this.txtMa_Nh_Ts.Value, ")" });
            }
            if (string.IsNullOrEmpty(this.txtMa_Ts.Value.ToString()))
            {
                base.StimulReport["VatTu"] = "";
            }
            else
            {
                base.StimulReport["VatTu"] = string.Concat(new object[] { "Thiết bị: ", this.txtTen_Ts.Value, " (", this.txtMa_Ts.Value, ")" });
            }
        }
    }
}

